#ifndef RTW_HEADER_SOC_GX_h_
#define RTW_HEADER_SOC_GX_h_
#ifndef SOC_GX_COMMON_INCLUDES_
#define SOC_GX_COMMON_INCLUDES_
#include "rtwtypes.h"
#endif

#include "SOC_GX_types.h"
#include "Timer_Delay_Check_CRC_SOC.h"
#include "rtGetInf.h"
#include "rt_nonfinite.h"

#include "calPrms.h"

#include "Rte.h"

typedef struct {
  uint16_T count;
  uint8_T is_c14_SOC_GX;
  uint8_T is_active_c14_SOC_GX;
} DW_Alarm_nonRecov_sys_soc_cel_T;

typedef struct {
  uint32_T Sum1;
  real32_T Lookup_RealSOC[2];
  real32_T Calib_RealSOC[2];
  real32_T Subtract;
  real32_T SOC_Correct;
  boolean_T OutportBufferForAlarm_flg;
  boolean_T SOC_95_Keep[2];
  boolean_T SOC_99_Keep[2];
  boolean_T SOC_95_Reset[2];
  boolean_T SOC_99_Reset[2];
  boolean_T SOC_10_Keep[2];
  boolean_T SOC_5_Keep[2];
  boolean_T SOC_10_Reset[2];
  boolean_T SOC_5_Reset[2];
  boolean_T Full_Flg_Keep;
  boolean_T SOC_0_Reset[2];
  boolean_T SOC_0_Keep[2];
} B_SOC_GX_c_T;

typedef struct {
  real32_T UnitDelay20_DSTATE[2];
  real32_T UnitDelay5_DSTATE;
  real32_T UnitDelay20_DSTATE_d[2];
  real32_T UnitDelay21_DSTATE;
  real32_T UnitDelay3_DSTATE[2];
  real32_T UnitDelay13_DSTATE;
  real32_T UnitDelay19_DSTATE;
  real32_T UnitDelay1_DSTATE;
  real32_T UnitDelay_DSTATE[2];
  real32_T UnitDelay14_DSTATE;
  real32_T UnitDelay8_DSTATE;
  real32_T UnitDelay5_DSTATE_m;
  real32_T UnitDelay7_DSTATE;
  real32_T UnitDelay10_DSTATE;
  real32_T UnitDelay11_DSTATE;
  real32_T UnitDelay12_DSTATE;
  real32_T UnitDelay8_DSTATE_f;
  real32_T UnitDelay16_DSTATE[2];
  real32_T UnitDelay9_DSTATE;
  real32_T UnitDelay25_DSTATE;
  real32_T UnitDelay12_DSTATE_l;
  real32_T UnitDelay28_DSTATE;
  real32_T UnitDelay13_DSTATE_d;
  real32_T UnitDelay27_DSTATE;
  uint32_T UnitDelay_DSTATE_d;
  uint16_T UnitDelay16_DSTATE_i[2];
  uint16_T UnitDelay2_DSTATE;
  uint16_T UnitDelay3_DSTATE_p;
  uint16_T T;
  uint16_T T_l;
  uint16_T T_p;
  uint8_T UnitDelay3_DSTATE_h;
  uint8_T UnitDelay4_DSTATE;
  uint8_T UnitDelay2_DSTATE_b;
  boolean_T UnitDelay_DSTATE_o;
  boolean_T UnitDelay21_DSTATE_f;
  boolean_T UnitDelay6_DSTATE;
  boolean_T UnitDelay17_DSTATE;
  boolean_T UnitDelay22_DSTATE;
  boolean_T UnitDelay2_DSTATE_a;
  boolean_T UnitDelay11_DSTATE_e;
  boolean_T UnitDelay14_DSTATE_h;
  boolean_T UnitDelay4_DSTATE_e;
  boolean_T UnitDelay6_DSTATE_p;
  boolean_T UnitDelay9_DSTATE_a;
  boolean_T UnitDelay13_DSTATE_i;
  boolean_T UnitDelay11_DSTATE_a;
  boolean_T UnitDelay10_DSTATE_d;
  boolean_T UnitDelay14_DSTATE_a;
  uint8_T is_c8_SOC_GX;
  uint8_T is_active_c8_SOC_GX;
  uint8_T is_active_c7_SOC_GX;
  uint8_T is_c4_SOC_GX;
  uint8_T is_active_c4_SOC_GX;
  boolean_T Subsystem2_MODE;
  boolean_T DiscreteIntegrator1_MODE;
  DW_Alarm_nonRecov_sys_soc_cel_T sf_Chart3;
  DW_Timer_Delay_Check_CRC_SOC_T Timer_Delay_Check_CRC_SOC4;
  DW_Timer_Delay_Check_CRC_SOC_T Timer_Delay_Check_CRC_SOC3;
  DW_Timer_Delay_Check_CRC_SOC_T Timer_Delay_Check_CRC_SOC2;
  DW_Timer_Delay_Check_CRC_SOC_T Timer_Delay_Check_CRC_SOC1;
  DW_Timer_Delay_Check_CRC_SOC_T Timer_Delay_Check_CRC_SOC_h;
} DW_SOC_GX_f_T;

struct tag_RTM_SOC_GX_T {
  const char_T **errorStatus;
};

typedef struct {
  B_SOC_GX_c_T rtb;
  DW_SOC_GX_f_T rtdw;
  RT_MODEL_SOC_GX_T rtm;
} MdlrefDW_SOC_GX_T;

extern void SOC_GX_initialize(const char_T **rt_errorStatus, RT_MODEL_SOC_GX_T *
  const SOC_GX_M);
extern void Alarm_nonRecov_sys_soc_cellT_Valid_Init(boolean_T *rty_Alarm_flg);
extern void Alarm_nonRecov_sys_soc_cellT_Valid_Reset(boolean_T *rty_Alarm_flg,
  DW_Alarm_nonRecov_sys_soc_cel_T *localDW);
extern void Alarm_nonRecov_sys_soc_cellT_Valid(const boolean_T *rtu_Err_flg,
  uint16_T rtu_Alarm_time, boolean_T *rty_Alarm_flg,
  DW_Alarm_nonRecov_sys_soc_cel_T *localDW);
extern void SOC_GX_Init(DW_SOC_GX_f_T *localDW);
extern void SOC_GX_Disable(B_SOC_GX_c_T *localB, DW_SOC_GX_f_T *localDW);
extern void SOC_GX(const uint32_T *rtu_System_Time_Current, const uint32_T
                   *rtu_System_Time_Recored, const uint8_T *rtu_INI_Flag, const
                   boolean_T *rtu_SOC_Correct_Flag, const boolean_T
                   *rtu_RTC_Reset_Flag, const uint8_T *rtu_FullChrg_Flg_Read,
                   const boolean_T *rtu_RTC_Time_Flag, const real32_T
                   *rtu_Count_UseSOC, const real32_T *rtu_RealSOC_EE_Max, const
                   real32_T *rtu_ActSOC_EE_Min, const uint16_T *rtu_CellV_min,
                   const uint16_T *rtu_CellV_max, const boolean_T
                   *rtu_CellTmax_Valid, const int16_T *rtu_CellT_mean, const
                   uint8_T *rtu_Fullchrg_Flag, const boolean_T *rtu_Flag_Chrg,
                   const uint8_T *rtu_writeSOCDisp_flg, const uint8_T
                   *rtu_writeSOCMax_flg, const uint8_T *rtu_writeSOCMin_flg,
                   const real32_T *rtu_writeSOCDisp, const real32_T
                   *rtu_writeSOCMax, const real32_T *rtu_writeSOCMin, const
                   real32_T *rtu_RptSOC_EE, const int32_T *rtu_Current_mA, const
                   int16_T *rtu_CellT_min, const int16_T *rtu_CellT_min_Read,
                   const real32_T *rtu_SOH, const boolean_T *rtu_AP, const
                   boolean_T *rtu_CellV_Valid, real32_T *rty_Real_SOC_Max,
                   real32_T *rty_Real_SOC_Min, real32_T *rty_Act_SOC, real32_T
                   *rty_Rpt_SOC, real32_T *rty_UseSOC, boolean_T
                   *rty_Swich_ONOFF, real32_T *rty_Factor_Cap, uint8_T
                   *rty_R_Rpt, uint32_T *rty_Ah_IN, uint8_T
                   *rty_Factor_SOC95_keep, uint8_T *rty_DB_OCV_Condition,
                   B_SOC_GX_c_T *localB, DW_SOC_GX_f_T *localDW);

#endif

